package com.powerhua.core.base.bean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Brian.Xie
 */
public class BaseModel implements IModel {

    private String modelId;

    private String modelTable;

    private Map<String, IField> fields = new HashMap<String, IField>();

    private List<String> fieldNames = new ArrayList<String>();

    private List<IModel> subModels = new ArrayList<IModel>();

    private IField pk;

    /**
     * 
     * @return
     */
    @Override
    public String getModelId() {
        return modelId;
    }

    /**
     * 
     * @param modelName
     */
    @Override
    public void setModelId(String modelId) {
        this.modelId = modelId;
    }

    /**
     * 
     * @return
     */
    @Override
    public List<IModel> getSubModels() {
        return subModels;
    }

    /**
     * 
     * @param beanList
     */
    @Override
    public void setSubModels(List<IModel> subModels) {
        this.subModels = subModels;
    }

    /**
     * 
     * @return
     */
    @Override
    public Map<String, IField> getFields() {
        return fields;
    }

    /**
     * 
     * @param fields
     */
    @Override
    public void setFields(Map<String, IField> fields) {
        this.fields = fields;
    }

    /**
     * 
     * @param name
     * @param value
     */
    @Override
    public void setField(String name, IField field) {
        this.fields.put(name, field);
    }

    @Override
    public void setModelTable(String modelTable) {
        this.modelTable = modelTable;
    }

    @Override
    public String getModelTable() {
        return this.modelTable;
    }

    /**
     * @return the pk
     */
    @Override
    public IField getPk() {
        return pk;
    }

    /**
     * @param pk the pk to set
     */
    @Override
    public void setPk(IField pk) {
        this.pk = pk;
    }

    @Override
    public List<String> getFieldNames() {
        return fieldNames;
    }

    @Override
    public void setFieldNames(List<String> fieldNames) {
        this.fieldNames = fieldNames;
    }

    @Override
    public void addFieldName(String fieldName) {
        this.fieldNames.add(fieldName);
    }
}
